; E:\PORNPOJ\Y2005\INC361\EX2010\TESTERROR.C - Compiled by CC68K  Version 5.00 (c) 1991-2005  Peter J.Fondse
; #include<stdio.h>
; #include<string.h>
; struct contact {
; char name[15];
; char phone[10];
; };
; int main()
; {
       section   code
       xdef      _main
_main:
       link      A6,#-276
       movem.l   D2/A2/A3/A4,-(A7)
       lea       _printf,A2
       lea       -260(A6),A3
       lea       _scanf,A4
; int i,n,y;
; char x[5];
; struct contact s[10];
; i = 0;
       clr.l     D2
; do {
main_1:
; printf("Please input your name and phone number\n");
       pea       @tester~1_1
       jsr       (A2)
       addq.w    #4,A7
; scanf("%s",s[i].name);
       move.l    A3,D1
       move.l    D0,-(A7)
       move.l    D2,D0
       muls      #26,D0
       add.l     D0,D1
       move.l    (A7)+,D0
       move.l    D1,-(A7)
       pea       @tester~1_2
       jsr       (A4)
       addq.w    #8,A7
; scanf("%s",s[i].phone);
       moveq     #16,D1
       move.l    D0,-(A7)
       move.l    A3,D0
       move.l    D1,-(A7)
       move.l    D2,D1
       muls      #26,D1
       add.l     D1,D0
       move.l    (A7)+,D1
       add.l     D0,D1
       move.l    (A7)+,D0
       move.l    D1,-(A7)
       pea       @tester~1_3
       jsr       (A4)
       addq.w    #8,A7
; printf("Name : %s\n",s[i].name);
       move.l    A3,D1
       move.l    D0,-(A7)
       move.l    D2,D0
       muls      #26,D0
       add.l     D0,D1
       move.l    (A7)+,D0
       move.l    D1,-(A7)
       pea       @tester~1_4
       jsr       (A2)
       addq.w    #8,A7
; printf("Phone number : %s\n",s[i].phone);
       moveq     #16,D1
       move.l    D0,-(A7)
       move.l    A3,D0
       move.l    D1,-(A7)
       move.l    D2,D1
       muls      #26,D1
       add.l     D1,D0
       move.l    (A7)+,D1
       add.l     D0,D1
       move.l    (A7)+,D0
       move.l    D1,-(A7)
       pea       @tester~1_5
       jsr       (A2)
       addq.w    #8,A7
; i++;
       addq.l    #1,D2
; printf("Do you want to continue this program? y/n\n");
       pea       @tester~1_6
       jsr       (A2)
       addq.w    #4,A7
; scanf("%s",x);
       pea       -266(A6)
       pea       @tester~1_7
       jsr       (A4)
       addq.w    #8,A7
       move.b    -266+0(A6),D0
       ext.w     D0
       ext.l     D0
       cmp.l     #110,D0
       bne       main_1
main_2:
; }
; while(x[0] != 'n');
; printf(">>>Good Bye<<<");
       pea       @tester~1_8
       jsr       (A2)
       addq.w    #4,A7
; return 0;
       clr.l     D0
main_3:
       movem.l   (A7)+,D2/A2/A3/A4
       unlk      A6
       rts
; }
       section   data
@tester~1_1:
       dc.b      80,108,101,97,115,101,32,105,110,112,117,116
       dc.b      32,121,111,117,114,32,110,97,109,101,32,97,110
       dc.b      100,32,112,104,111,110,101,32,110,117,109,98
       dc.b      101,114,10,0
@tester~1_2:
       dc.b      37,115,0
@tester~1_3:
       dc.b      37,115,0
@tester~1_4:
       dc.b      78,97,109,101,32,58,32,37,115,10,0
@tester~1_5:
       dc.b      80,104,111,110,101,32,110,117,109,98,101,114
       dc.b      32,58,32,37,115,10,0
@tester~1_6:
       dc.b      68,111,32,121,111,117,32,119,97,110,116,32,116
       dc.b      111,32,99,111,110,116,105,110,117,101,32,116
       dc.b      104,105,115,32,112,114,111,103,114,97,109,63
       dc.b      32,121,47,110,10,0
@tester~1_7:
       dc.b      37,115,0
@tester~1_8:
       dc.b      62,62,62,71,111,111,100,32,66,121,101,60,60
       dc.b      60,0
       xref      _scanf
       xref      _printf
